package com.example.linearlayoutdemo.avatar;

public class UserManager {
    // 单例模式
    private static UserManager instance;
    private String currentUserId;

    private UserManager() {}

    public static synchronized UserManager getInstance() {
        if (instance == null) {
            instance = new UserManager();
        }
        return instance;
    }

    // 设置当前登录用户ID
    public void setCurrentUserId(String userId) {
        this.currentUserId = userId;
    }

    // 获取当前登录用户ID
    public String getCurrentUserId() {
        return currentUserId;
    }

    // 退出登录时清除用户ID
    public void logout() {
        currentUserId = null;
    }
}
